<?php 

require_once '../mysqlConnect.php';

if (isset($_POST)) {
	
	
	if (!isset($_POST['result1']) || !isset($_POST['result2']) || !isset($_POST['id'])) {
		$returnValue = 'error';
	} else {
		
		$id = ltrim($_POST['id'], 'diagnostic');
		$result1 = $_POST['result1'];
		$result2 = $_POST['result2'];
		$sql = "UPDATE medical_test_answers SET result1 = '" . $result1 . "', result2 = '" . $result2 . "' WHERE id = '" . $id . "' LIMIT 1";
		
		$conn = GetConnection();
		$conn->query($sql);
		if ($conn->connect_errno)
			$returnValue = 'error';
		elseif ($conn->error)
			$returnValue = 'error';
		else
			$returnValue = 'success';
	}
	
	echo $returnValue;
}